home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / pctuto.zip / BLOAD.COM / BLOAD.DOC < prev    next >
Text File  |  1990-08-06  |  9KB  |  228 lines

  1.  
  2.  
  3.  
  4.                                                                              1
  5.  
  6.                                   MAKEBLD AND STRIPBLD
  7.  
  8.  
  9.              There are two functions in BASIC called BSAVE and BLOAD. BSAVE
  10.              writes data from memory to disk and BLOAD reads data from disk
  11.              into memory. The disk file consists of seven bytes of BLOAD
  12.              information followed by an exact copy of what was in memory.
  13.              Using BSAVE and BLOAD is much faster than using the INPUT/WRITE
  14.              functions. It has two uses.
  15.  
  16.                  1) If you have a large array of data, you can transfer the
  17.                  binary data directly to and from disk. This can make the
  18.                  disk read 20 to 50 times faster. Instead of 20 seconds, it
  19.                  might take 1 second.
  20.  
  21.                  2) If you have an assembler subroutine in binary format,
  22.                  this is the only way to read it in. Using a binary file for
  23.                  assembler subprograms has been outdated since QuickBasic
  24.                  3.0, but you can do it if you feel like it.
  25.  
  26.              The problem with BSAVE and BLOAD is twofold. First, if you have
  27.              data or an assembler subprogram which you want to load into
  28.              memory for the first time, BLOAD will not work since it needs
  29.              those first seven bytes of information. Secondly, if you save
  30.              data to disk and then want to use it with another programming
  31.              language, you may have some trouble because the first seven bytes
  32.              of the file are BLOAD information, not data.
  33.  
  34.              MAKEBLD.COM is designed to put the correct information in the
  35.              first seven bytes of a file and then append the data. STRIPBLD is
  36.              designed to take away the first seven bytes of a legitimate BLOAD
  37.              file and leave the data which has been saved by BASIC.
  38.  
  39.  
  40.              To create a file which you can BLOAD, use MAKEBLD:
  41.  
  42.                  >makebld  sourcefile  bloadfile
  43.  
  44.              where 'sourcefile' is the source data file that you want to alter
  45.              and 'bloadfile' is the name of the file which will be loaded into
  46.              memory. You must use the full filename (name + extension) for
  47.              both files. Pathnames are allowed. 
  48.  
  49.  
  50.              To strip the BLOAD information from a file, use STRIPBLD:
  51.  
  52.                  >stripbld  bloadfile  datafile
  53.  
  54.              where 'bloadfile' is the file which has been BSAVEd from memory
  55.              and 'datafile' is the file which contains only the data which was
  56.              in memory.
  57.  
  58.  
  59.  
  60.  
  61.              ______________________
  62.  
  63.              Copyright (C) 1990 Chuck Nelson
  64.  
  65.  
  66.  
  67.  
  68.              MAKEBLD AND STRIPBLD                                            2
  69.              ____________________
  70.  
  71.              POSSIBLE ERRORS
  72.  
  73.              There are several error messages which you might receive from
  74.              these programs. These messages apply to both programs.
  75.  
  76.  
  77.                  1) "Bad command line. Proper line is:  ... "
  78.                  You must enter both the source file and destination file on
  79.                  the command line, and the progran has not detected two
  80.                  entries on the command line.
  81.  
  82.                  2) "Can't open the first file"
  83.                     "Can't open the second file"
  84.                  The first file must exist and the second file must be a
  85.                  valid filename or pathname.
  86.  
  87.                  3) "File too large"
  88.                  There is an upper limit of 65535 bytes of binary data in a
  89.                  bload file (excluding the bload information and any end of
  90.                  file marker).
  91.  
  92.  
  93.              There are several error messages which you are not likely to see,
  94.              but here is what caused them.
  95.  
  96.                  4) "No room for i/o buffer"
  97.                  There was less than about 2500 bytes of free memory when the
  98.                  program was loaded and the program has no room for doing
  99.                  i/o. This means that you are already using all of memory
  100.                  with other programs.
  101.  
  102.                  5) "Bad file read"
  103.                     "Bad file write"
  104.                  These are DOS disk read/write errors.
  105.  
  106.  
  107.              In addition, there are several error messages that you might get
  108.              from STRIPBLD.
  109.  
  110.                  a) "Bad bload signature"
  111.                  The program checks the first byte of the file for a value of
  112.                  &HFD. If it finds a different value it will warn you. The
  113.                  next line will contain a hex number. The two left digits
  114.                  will be &H00, and the two right digits will be the hex value
  115.                  of the first byte. This is probably not a bload file, but
  116.                  the program will allow you to continue.
  117.  
  118.                  b) "Non-matching file sizes"
  119.                  The program compares the file size to the size specified in
  120.                  the bload information. If they are not equal, or if the file
  121.                  is not one byte bigger (to allow for an end of file byte),
  122.                  the program will signal the error. The next line will
  123.                  contain a hex number which is [filesize - bloadsize]. The
  124.                  length of the bload information is not included in this
  125.                  calculation.
  126.  
  127.              If either of these errors occurs, you will be prompted:
  128.  
  129.  
  130.  
  131.  
  132.              MAKEBLD AND STRIPBLD                                            3
  133.              ____________________
  134.  
  135.  
  136.                  "Do you want to continue? (y/n)"
  137.  
  138.              Press 'Y' or 'y' to continue or any other key to exit. If you
  139.              continue, STRIPBLD will strip the first seven bytes and then make
  140.              a file which is the SMALLER of:
  141.  
  142.                  1) the data size from the bload information.
  143.                  2) the size of the remaining file.
  144.  
  145.  
  146.              BLOAD INFORMATION
  147.  
  148.              The seven byte bload header consists of:
  149.  
  150.                  BYTE           INFORMATION
  151.  
  152.                   1             &HFD  - the bload signature byte
  153.                  2-3            segment where the data came from
  154.                  4-5            offset where the information came from
  155.                  6-7            length of the data
  156.  
  157.              For those of you who do not know about the 8086 memory scheme,
  158.              bytes 2-5 give you the address in memory where the data started.
  159.              The size of the file is one word, so it is limited to the range
  160.              of 0 - 65535 bytes.
  161.  
  162.  
  163.              END OF FILE
  164.  
  165.              BASIC may put and end of file marker at the end of the data when
  166.              it BSAVEs it. If STRIPBLD detects that the file is one byte too
  167.              long, it will assume that the last byte is an EOF marker and will
  168.              leave it out of the destination file. MAKEBLD puts no EOF marker
  169.              at the end of the file it creates. 
  170.  
  171.              The size of data in the BLOAD file created by MAKEBLD is seven
  172.              bytes less than the filesize. It is possible for EOF markers to
  173.              creep in when transfering data between programs, so if you have
  174.              an array, it is safer if you have one dummy array element at the
  175.              top to insure that the BLOAD file does not run past the array.
  176.  
  177.  
  178.  
  179.              BINARY DATA
  180.  
  181.              If you have a file with numeric data in it, it is easy to tell if
  182.              it is text data or binary data. Just enter:
  183.  
  184.                  >type filename
  185.  
  186.              Your screen will show the contents of the file. If the screen
  187.              shows lots of non-numeric characters (or no visible characters),
  188.              it is a binary file. If the output is all digits, it is a text
  189.              file. BLOAD and BASVE are for binary, not text, data.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.              MAKEBLD AND STRIPBLD                                            4
  197.              ____________________
  198.  
  199.              REGISTRATION
  200.  
  201.              There is no registration fee for these programs. The programs and
  202.              manual may be distributed as long as:
  203.  
  204.                  1) they remain unaltered and are distributed together as a
  205.                  compressed LHARC file.
  206.  
  207.                  2) they are either distributed without cost or they make up
  208.                  less than 5% (by filesize) of the files on a disk which is
  209.                  being distributed for a fee.
  210.  
  211.  
  212.  
  213.  
  214.              Chuck Nelson
  215.              NELSOFT
  216.              P.O. Box 21389
  217.              Oakland, CA  94620
  218.  
  219.  
  220.                                       WARRANTY
  221.  
  222.              THESE PROGRAMS AND INSTRUCTION MANUAL ARE BEING DISTRIBUTED
  223.              "AS IS", WITHOUT WARRANTY AS TO THEIR PERFORMANCE, 
  224.              MERCHANTIBILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. THE
  225.              ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF THESE
  226.              PROGRAMS IS ASSUMED BY YOU.
  227.  
  228.